package com.process;

import java.io.*;

public class Test2 {
    public static void main(String[] args) {
//        String filename = "/usr/local/src/main.cpp"; // C语言文件名
//        // 编译命令
//
//        try {
//            ProcessBuilder builder = new ProcessBuilder("g++",filename);
//            builder.redirectErrorStream(true);
//            System.out.print(System.currentTimeMillis());
//            Process process = builder.start();
//            System.out.print(System.currentTimeMillis());
//            // 输出编译信息
//
//            int exitCode = process.waitFor();
//            if (exitCode == 0) {
//                System.out.println("编译成功！");
//            } else {
//                System.out.println("编译失败");
//            }
//        } catch (IOException | InterruptedException e) {
//            e.printStackTrace();
//        }

        String fileName = "D:\\a.exe";
        ProcessBuilder builder = new ProcessBuilder(".\\" + fileName);
        builder.redirectErrorStream(true);


    }
}
